package distributedbank.server.messages;

import java.io.IOException;
import java.io.Serializable;

import distributedbank.Wrapper;
import distributedbank.server.BankBranch;

/**
 * A request is intended for transmission over the network to a bank branch. A
 * request is able to serialize/de-serialize itself after being read from the
 * network. It is also able to execute itself on a BankBranch using the
 * runRequest method.
 * 
 * There are multiple types of Requests; each different type is represented by a
 * class that extends the Request class.
 */
public abstract class Request implements Serializable
{
    private static final long serialVersionUID = 1L;

    public final int branchId; // the branch that this message is intended for

    public Request( int branchId ) {
        this.branchId = branchId;
    }

    public abstract void runRequest(BankBranch bankBranch, Wrapper wrapper)
            throws IOException, ClassNotFoundException;

}
